package com.lwj.liwanjia.adapter.indent;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.adapter.DaiFaHuoAdapter;
import com.lwj.liwanjia.bean.MyIndentBean;
import com.lwj.liwanjia.config.OnClickPosition;
import com.lwj.liwanjia.config.OnItemChildClickListener;
import com.lwj.liwanjia.config.OnItemClickListener;
import com.lwj.liwanjia.utils.TimeCountDown1;
import com.lwj.liwanjia.view.activity.indent.UnpaidActivity;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;
import com.superrecycleview.superlibrary.recycleview.SuperRecyclerView;

import java.util.Calendar;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/9/23.
 */
public class AllAdapter extends RecyclerView.Adapter<AllAdapter.MyViewHolder> {
    private Context mContext;
    private List<MyIndentBean.DataBean> list;
    private boolean flag;//用来判断是否是详情 true代表是
    //用于退出 Activity,避免 Countdown，造成资源浪费。
    private SparseArray<TimeCountDown1> countDownCounters;
    private LayoutInflater inflater;
    private OnItemClickListener listener;
    private OnItemChildClickListener childListener;
    private OnClickPosition clickPosition;

    public void setClickPosition(OnClickPosition clickPosition) {
        this.clickPosition = clickPosition;
    }

    public void setChildListener(OnItemChildClickListener childListener) {
        this.childListener = childListener;
    }

    public void setListener(OnItemClickListener listener) {
        this.listener = listener;
    }

    public AllAdapter(Context mContext, List<MyIndentBean.DataBean> list, boolean flag) {
        this.mContext = mContext;
        this.flag = flag;
        inflater = LayoutInflater.from(mContext);
        this.list = list;
        this.countDownCounters = new SparseArray<>();
    }

    /**
     * 清空当前 CountTimeDown 资源
     */
    public void cancelAllTimers() {
        if (countDownCounters == null) {
            return;
        }
        for (int i = 0, length = countDownCounters.size(); i < length; i++) {
            TimeCountDown1 cdt = countDownCounters.get(countDownCounters.keyAt(i));
            if (cdt != null) {
                cdt.cancel();
            }
        }
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (list.get(viewType).getTitle().equals("购物")) {
            View view = inflater.inflate(R.layout.unpaid_item, parent, false);
            MyViewHolder holder = new MyViewHolder(view);
            return holder;
        }
        return null;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, final int position) {
        final MyIndentBean.DataBean.GoodsBean goods = list.get(position).getGoods();
        if (goods.getStatus().equals("待付款")) {
            holder.llFukuan.setVisibility(View.VISIBLE);
            holder.tvState.setText("待付款");
            holder.rlIndentBtn.setVisibility(View.GONE);
        } else if (goods.getStatus().equals("待发货") || goods.getStatus().equals("待收货")) {
            holder.llFukuan.setVisibility(View.GONE);
            holder.rlIndentBtn.setVisibility(View.VISIBLE);
            holder.tvDeleteIndent.setVisibility(View.VISIBLE);
            if (goods.getStatus().equals("待发货")) {
                holder.tvState.setText("待发货");
                holder.tvDeleteIndent.setText("取消订单");
                holder.tvQuxiaoIndent.setText("联系商家");
            } else {
                holder.tvState.setText("待收货");
                holder.tvDeleteIndent.setText("联系商家");
                holder.tvQuxiaoIndent.setText("确认收货");
            }
        } else if (goods.getStatus().equals("已完成")) {
            holder.tvState.setText("已完成");
            holder.llFukuan.setVisibility(View.GONE);
            holder.rlIndentBtn.setVisibility(View.VISIBLE);
            holder.tvDeleteIndent.setVisibility(View.VISIBLE);
            holder.tvDeleteIndent.setText("删除订单");
            if (goods.getAssess() == 0) {//待评价
                holder.tvQuxiaoIndent.setText("评价");
            } else if (goods.getAssess() == 1) {//追加评价
                holder.tvQuxiaoIndent.setText("追加评价");
            } else {
                holder.tvQuxiaoIndent.setText("联系商家");
            }
        } else if (goods.getStatus().equals("订单取消")) {//新增的待付款时间到了的订单
            holder.tvState.setText("已取消");
            holder.llFukuan.setVisibility(View.GONE);
            holder.rlIndentBtn.setVisibility(View.VISIBLE);
            holder.tvDeleteIndent.setVisibility(View.GONE);
            holder.tvQuxiaoIndent.setText("删除订单");
        } else if (goods.getStatus().contains("未同意")) {
            holder.tvState.setText(goods.getStatus());
            holder.llFukuan.setVisibility(View.GONE);
            holder.rlIndentBtn.setVisibility(View.VISIBLE);
            holder.tvDeleteIndent.setVisibility(View.VISIBLE);
            holder.tvDeleteIndent.setText("删除订单");
            holder.tvQuxiaoIndent.setText("联系商家");
        }
        if (list.get(position).getTitle().equals("购物")) {
            holder.tvMarket.setText(goods.getShopname());
            holder.tvShangchengNumber.setText("共" + goods.getAmount() + "件商品 合计：");
            holder.tvShangchengPrice.setText("￥" + goods.getTotalpay() + "(含运费￥0.00)");
            Glide.with(mContext).load(goods.getShopimage()).error(R.mipmap.shop_image_2).into(holder.ivMarket);
            LinearLayoutManager manager = new LinearLayoutManager(mContext);
            manager.setOrientation(LinearLayoutManager.VERTICAL);
            holder.rlvGouwuche.setLayoutManager(manager);
            holder.rlvGouwuche.setRefreshEnabled(false);
            holder.rlvGouwuche.setLoadMoreEnabled(false);
            ShopUnpaidAdater1 adapter = new ShopUnpaidAdater1(mContext, goods.getCommodity(), flag);
            holder.rlvGouwuche.setAdapter(adapter);
            adapter.setOnItemClickListener(new SuperBaseAdapter.OnItemClickListener() {
                @Override
                public void onItemClick(View view, Object item, int position1) {
                    if (clickPosition != null) {
                        clickPosition.clickPosition(position);
                    }
                    Intent intent = new Intent(mContext, UnpaidActivity.class);
                    intent.putExtra("tradeId", list.get(position).getGoods().getTradeId());
                    mContext.startActivity(intent);
                }
            });
            long now = Calendar.getInstance().getTimeInMillis();
            TimeCountDown1 countDown1 = countDownCounters.get(holder.tvSecond.hashCode());
            //去掉复用倒计时
            if (countDown1 != null) {
                countDown1.cancel();
            }
            countDown1 = new TimeCountDown1(goods.getEndPayTime() - now, 1000, holder.tvMinute, holder.tvSecond);
            countDown1.start();
            countDownCounters.put(holder.tvSecond.hashCode(), countDown1);
            if (listener != null) {
                holder.rlGouwu.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        listener.OnItemClick(v, position);
                    }
                });
            }
            if (childListener != null) {
                holder.tvDeleteIndent.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        childListener.OnItemChildClick(v, goods.getStatus(), position);
                    }
                });
                holder.tvQuxiaoIndent.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        childListener.OnItemChildClick(v, goods.getStatus(), position);
                    }
                });
            }
        }

    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.rl_gouwu)
        RelativeLayout rlGouwu;
        @BindView(R.id.iv_market)
        ImageView ivMarket;
        @BindView(R.id.tv_market)
        TextView tvMarket;
        @BindView(R.id.tv_state)
        TextView tvState;
        @BindView(R.id.rl_market)
        RelativeLayout rlMarket;
        @BindView(R.id.rlv_gouwuche)
        SuperRecyclerView rlvGouwuche;
        @BindView(R.id.line)
        View line;
        @BindView(R.id.tv_shangcheng_price)
        TextView tvShangchengPrice;
        @BindView(R.id.tv_shangcheng_number)
        TextView tvShangchengNumber;
        @BindView(R.id.rl_jiage)
        RelativeLayout rlJiage;
        @BindView(R.id.line1)
        View line1;
        @BindView(R.id.tv_minute)
        TextView tvMinute;
        @BindView(R.id.tv_second)
        TextView tvSecond;
        @BindView(R.id.ll_fukuan)
        LinearLayout llFukuan;
        @BindView(R.id.tv_quxiao_indent)
        TextView tvQuxiaoIndent;
        @BindView(R.id.tv_delete_indent)
        TextView tvDeleteIndent;
        @BindView(R.id.rl_indent_btn)
        RelativeLayout rlIndentBtn;
        @BindView(R.id.indent_btn)
        RelativeLayout indentBtn;

        public MyViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

//public class AllAdapter extends SuperBaseAdapter<AllIndentBean>
//测试数据
//    private List<String> list;//商城
//    private Context mContext;
//    private boolean flag;//用来判断是否是详情 true代表是
//
//    public AllAdapter(Context context, List<AllIndentBean> data, boolean flag) {
//        super(context, data);
//        list = new ArrayList<>();
//        list.add("1");
//        this.flag = flag;
//        this.mContext = context;
//    }
//
//    @Override
//    protected void convert(BaseViewHolder holder, AllIndentBean item, int position) {
//        String s = item.getList().get(position);
//        if (item.getState().equals("待付款")) {
//            holder.setVisible(R.id.ll_fukuan, true)
//                    .setText(R.id.tv_state, "待付款")
//                    .setVisible(R.id.rl_indent_btn, false);//订单按钮可见
//            if (s.equals("0")) {
//                SuperRecyclerView rlvGouwuche = holder.getView(R.id.rlv_gouwuche);
//                LinearLayoutManager manager = new LinearLayoutManager(mContext);
//                manager.setOrientation(LinearLayoutManager.VERTICAL);
//                rlvGouwuche.setLayoutManager(manager);
//                rlvGouwuche.setRefreshEnabled(false);
//                rlvGouwuche.setLoadMoreEnabled(false);
//                ShopUnpaidAdater adapter = new ShopUnpaidAdater(mContext, list, flag);
//                rlvGouwuche.setAdapter(adapter);
//            } else if (s.equals("5")) {
//                SuperRecyclerView rlvJiudian = holder.getView(R.id.rlv_jiudian);
//                LinearLayoutManager manager = new LinearLayoutManager(mContext);
//                manager.setOrientation(LinearLayoutManager.VERTICAL);
//                rlvJiudian.setLayoutManager(manager);
//                rlvJiudian.setRefreshEnabled(false);
//                rlvJiudian.setLoadMoreEnabled(false);
//                JiudianAdapter jiudianAdapter = new JiudianAdapter(mContext, list);
//                rlvJiudian.setAdapter(jiudianAdapter);
//            } else if (s.equals("4")) {//宾馆
//                holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.binguantouxiang)
//                        .setVisible(R.id.rl_binguan2,true)
//                        .setText(R.id.tv_shangjia_name, "速8宾馆");
//
//            } else if (s.equals("3")) {
//                holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang_2)
//                        .setText(R.id.tv_shangjia_name, "KFFFSDDD");
//            } else if (s.equals("6") || s.equals("7") || s.equals("8")) {
//                if (s.equals("6")) {//帮我送
//                    holder.setText(R.id.tv_bangwo, "帮我送");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.fahuodizhi)
//                            .setImageResource(R.id.iv_address2, R.mipmap.quhuodizhi);
//                } else if (s.equals("7")) {//帮我取
//                    holder.setText(R.id.tv_bangwo, "帮我取");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.quhuodizhi)
//                            .setImageResource(R.id.iv_address2, R.mipmap.shouhuodizhi);
//                } else {
//                    holder.setText(R.id.tv_bangwo, "帮我买");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.purchaseadd)
//                            .setImageResource(R.id.iv_address2, R.mipmap.songhuodizhi);
//                }
//            }
//        } else if (item.getState().equals("待接单")) {
//            holder.setText(R.id.tv_state, "待接单");
//            holder.setVisible(R.id.ll_fukuan, false)//隐藏待付款按钮
//                    .setVisible(R.id.tv_delete_indent, false)//左边按钮可见
//                    .setVisible(R.id.rl_indent_btn, true);//显示取消订单
//            if (s.equals("20") || s.equals("21") || s.equals("22")) {//帮我送,买，取
//                if (item.equals("20")) {//帮我送
//                    holder.setText(R.id.tv_bangwo, "帮我送");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.fahuodizhi)
//                            .setImageResource(R.id.iv_address2, R.mipmap.quhuodizhi);
//                } else if (s.equals("21")) {//帮我取
//                    holder.setText(R.id.tv_bangwo, "帮我取");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.quhuodizhi)
//                            .setImageResource(R.id.iv_address2, R.mipmap.shouhuodizhi);
//                } else {
//                    holder.setText(R.id.tv_bangwo, "帮我买");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.purchaseadd)
//                            .setImageResource(R.id.iv_address2, R.mipmap.songhuodizhi);
//                }
//            } else if (s.equals("10")) {//旅游
//                holder.setVisible(R.id.rl_daoyou, false);//取消导游费用栏
//            }else if (s.equals("14")) {//酒店外卖
//                SuperRecyclerView rlvJiudian = holder.getView(R.id.rlv_jiudian);
//                LinearLayoutManager manager = new LinearLayoutManager(mContext);
//                manager.setOrientation(LinearLayoutManager.VERTICAL);
//                rlvJiudian.setLayoutManager(manager);
//                rlvJiudian.setRefreshEnabled(false);
//                rlvJiudian.setLoadMoreEnabled(false);
//                JiudianAdapter jiudianAdapter = new JiudianAdapter(mContext, list);
//                rlvJiudian.setAdapter(jiudianAdapter);
//            } else if (s.equals("12") || s.equals("13")) {//宾馆
//                if (s.equals("12")) {
//                    holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.binguantouxiang)
//                            .setVisible(R.id.rl_binguan2,true)
//                            .setText(R.id.tv_shangjia_name, "速8宾馆");
//                } else {//看房
//                    holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang_1)
//                            .setVisible(R.id.rl_binguan2,false)
//                            .setText(R.id.tv_shangjia_name, "JJFJFJFJF")
//                            .setText(R.id.tv_binguan_name, "龙湾区海滨房")
//                            .setText(R.id.tv_binguan_price, "￥3000.0元/月")
//                            .setText(R.id.tv_binguan_jiesao, "四周环绕着大海，每天清晨都会感受到一缕阳光。");
//                }
//            } else if (s.equals("9")) {//搬家
//                holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang_2)
//                        .setText(R.id.tv_shangjia_name, "KFFFSDDD");
//            } else if (s.equals("16") || s.equals("17")) {//滴滴
//                if (s.equals("17")) {//预约今天
//                    holder.setVisible(R.id.tv_yuyue, false);
//                } else {//预约明天
//                    holder.setVisible(R.id.tv_yuyue, true);
//                }
//                holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang)
//                        .setText(R.id.tv_shangjia_name, "GGHFHJFHF");
//            } else if (s.equals("18") || s.equals("19")) {//包间选择-预约酒店
//                if (item.equals("18")) {
//                    holder.setVisible(R.id.tv_red_circle, true)//红点显示
//                            .setVisible(R.id.indent_btn, false);//底部按钮隐藏
//                } else {
//                    holder.setVisible(R.id.tv_red_circle, false)//红点不显示
//                            .setVisible(R.id.indent_btn, true);//底部按钮显示
//                }
//            }
//        } else if (item.getState().equals("已接单")) {
//            holder.setVisible(R.id.ll_fukuan, false)
//                    .setText(R.id.tv_state, "已接单")
//                    .setVisible(R.id.rl_indent_btn, true)//订单按钮可见
//                    .setText(R.id.tv_quxiao_indent, "确认到达")
//                    .setVisible(R.id.tv_delete_indent, true);//左边按钮可见
//            if (s.equals("24")) {//导游
//                holder.setText(R.id.tv_quxiao_indent, "确认服务");
//            } else if (s.equals("25")) {//旅游
//                holder.setVisible(R.id.rl_daoyou, false);//取消导游费用栏
//            } else if (s.equals("26") || s.equals("27") || s.equals("28")) {//帮我送,买，取
//                if (s.equals("26")) {//帮我送
//                    holder.setText(R.id.tv_bangwo, "帮我送");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.fahuodizhi)
//                            .setImageResource(R.id.iv_address2, R.mipmap.quhuodizhi)
//                            .setText(R.id.tv_quxiao_indent, "确认送达");
//                } else if (s.equals("27")) {//帮我取
//                    holder.setText(R.id.tv_bangwo, "帮我取");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.quhuodizhi)
//                            .setImageResource(R.id.iv_address2, R.mipmap.shouhuodizhi);
//                } else {
//                    holder.setText(R.id.tv_bangwo, "帮我买");
//                    holder.setImageResource(R.id.iv_address1, R.mipmap.purchaseadd)
//                            .setImageResource(R.id.iv_address2, R.mipmap.songhuodizhi);
//                }
//
//            } else if (s.equals("30") || s.equals("31")) {
//                if (s.equals("30")) {
//                    holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.binguantouxiang)
//                            .setVisible(R.id.rl_binguan2,true)
//                            .setText(R.id.tv_shangjia_name, "速8宾馆");
//                } else {
//                    holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang_1)
//                            .setVisible(R.id.rl_binguan2,false)
//                            .setText(R.id.tv_shangjia_name, "JJFJFJFJF")
//                            .setText(R.id.tv_binguan_name, "龙湾区海滨房")
//                            .setText(R.id.tv_binguan_price, "￥3000.0元/月")
//                            .setText(R.id.tv_binguan_jiesao, "四周环绕着大海，每天清晨都会感受到一缕阳光。");
//                }
//            } else if (s.equals("32")) {//包间选择
//                holder.setVisible(R.id.tv_delete_indent, false);
//            } else if (s.equals("33") || s.equals("34")) {//酒店和转换成外卖
//                SuperRecyclerView rlvJiudian = holder.getView(R.id.rlv_jiudian);
//                LinearLayoutManager manager = new LinearLayoutManager(mContext);
//                manager.setOrientation(LinearLayoutManager.VERTICAL);
//                rlvJiudian.setLayoutManager(manager);
//                rlvJiudian.setRefreshEnabled(false);
//                rlvJiudian.setLoadMoreEnabled(false);
//                JiudianAdapter jiudianAdapter = new JiudianAdapter(mContext, list);
//                rlvJiudian.setAdapter(jiudianAdapter);
//                if (s.equals("33")) {
//                    holder.setText(R.id.tv_quxiao_indent, "确认用餐")
//                            .setText(R.id.tv_delete_indent, "转外卖");
//                } else if (s.equals("34")) {
//                    holder.setText(R.id.tv_quxiao_indent, "确认送达")
//                            .setVisible(R.id.tv_delete_indent, false);
//                }
//            } else if (s.equals("35") || s.equals("36")) {
//                if (s.equals("35")) {//预约今天
//                    holder.setVisible(R.id.tv_yuyue, false);
//                } else {//预约明天
//                    holder.setVisible(R.id.tv_yuyue, true);
//                }
//                holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang)
//                        .setText(R.id.tv_shangjia_name, "GGHFHJFHF");
//            } else if (s.equals("37")) {//搬家
//                holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang_2)
//                        .setText(R.id.tv_shangjia_name, "KFFFSDDD");
//            }
//        } else if (item.getState().equals("待发货") || item.getState().equals("待收货")) {
//            holder.setVisible(R.id.ll_fukuan, false)
//                    .setVisible(R.id.rl_indent_btn, true)//订单按钮可见
//                    .setVisible(R.id.tv_delete_indent, true);//左边按钮可见
//            SuperRecyclerView rlvGouwuche = holder.getView(R.id.rlv_gouwuche);
//            LinearLayoutManager manager = new LinearLayoutManager(mContext);
//            manager.setOrientation(LinearLayoutManager.VERTICAL);
//            rlvGouwuche.setLayoutManager(manager);
//            rlvGouwuche.setRefreshEnabled(false);
//            rlvGouwuche.setLoadMoreEnabled(false);
//            ShopUnpaidAdater adapter = new ShopUnpaidAdater(mContext, list, flag);
//            rlvGouwuche.setAdapter(adapter);
//            if (s.equals("38")) {
//                holder.setText(R.id.tv_state, "待发货")
//                        .setText(R.id.tv_quxiao_indent, "联系商家");
//            } else if (s.equals("39")) {
//                holder.setText(R.id.tv_state, "已发货")
//                        .setText(R.id.tv_quxiao_indent, "确认收货");
//            }
//        } else if (item.getState().equals("已完成"))
//            holder.setText(R.id.tv_state, "已完成")
//                    .setTextColor(R.id.tv_state, mContext.getResources().getColor(R.color.colorFF2D2E))
//                    .setText(R.id.tv_quxiao_indent, "评价")
//                    .setText(R.id.tv_delete_indent, "删除订单")
//                    .setVisible(R.id.ll_fukuan, false)
//                    .setVisible(R.id.rl_indent_btn, true)//订单按钮可见
//                    //  .setVisible(R.id.tv_quxiao_indent, false)//当评价完后，评价按钮隐藏
//                    .setVisible(R.id.tv_delete_indent, true);//左边按钮可见
//        if (s.equals("40") || s.equals("41") || s.equals("42")) {//商城类
//            if (s.equals("41")) {
//                holder.setText(R.id.tv_quxiao_indent, "追加评价");
//            } else if (s.equals("42")) {
//                holder.setText(R.id.tv_quxiao_indent, "再次购买");
//            } else {
//                holder.setText(R.id.tv_quxiao_indent, "评价");
//            }
//            SuperRecyclerView rlvGouwuche = holder.getView(R.id.rlv_gouwuche);
//            LinearLayoutManager manager = new LinearLayoutManager(mContext);
//            manager.setOrientation(LinearLayoutManager.VERTICAL);
//            rlvGouwuche.setLayoutManager(manager);
//            rlvGouwuche.setRefreshEnabled(false);
//            rlvGouwuche.setLoadMoreEnabled(false);
//            ShopUnpaidAdater adapter = new ShopUnpaidAdater(mContext, list, flag);
//            rlvGouwuche.setAdapter(adapter);
//        } else if (s.equals("43") || s.equals("44") || s.equals("45")) {//帮我买，送，取
//            if (s.equals("43")) {//帮我送
//                holder.setText(R.id.tv_bangwo, "帮我送");
//                holder.setImageResource(R.id.iv_address1, R.mipmap.fahuodizhi)
//                        .setImageResource(R.id.iv_address2, R.mipmap.quhuodizhi);
//            } else if (s.equals("44")) {//帮我取
//                holder.setText(R.id.tv_bangwo, "帮我取");
//                holder.setImageResource(R.id.iv_address1, R.mipmap.quhuodizhi)
//                        .setImageResource(R.id.iv_address2, R.mipmap.shouhuodizhi);
//            } else {
//                holder.setText(R.id.tv_bangwo, "帮我买");
//                holder.setImageResource(R.id.iv_address1, R.mipmap.purchaseadd)
//                        .setImageResource(R.id.iv_address2, R.mipmap.songhuodizhi);
//            }
//        } else if (s.equals("47")) {//旅游
//            holder.setVisible(R.id.rl_daoyou, false);//取消导游费用栏
//        } else if (s.equals("49") || s.equals("50")) {//宾馆看房
//            if (s.equals("49")) {
//                holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.binguantouxiang)
//                        .setVisible(R.id.rl_binguan2,true)
//                        .setText(R.id.tv_shangjia_name, "速8宾馆");
//            } else {//看房
//                holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang_1)
//                        .setVisible(R.id.rl_binguan2,false)
//                        .setText(R.id.tv_shangjia_name, "JJFJFJFJF")
//                        .setText(R.id.tv_binguan_name, "龙湾区海滨房")
//                        .setText(R.id.tv_binguan_price, "￥3000.0元/月")
//                        .setText(R.id.tv_binguan_jiesao, "四周环绕着大海，每天清晨都会感受到一缕阳光。");
//            }
//        } else if (s.equals("51")) {//酒店外卖
//            SuperRecyclerView rlvJiudian = holder.getView(R.id.rlv_jiudian);
//            LinearLayoutManager manager = new LinearLayoutManager(mContext);
//            manager.setOrientation(LinearLayoutManager.VERTICAL);
//            rlvJiudian.setLayoutManager(manager);
//            rlvJiudian.setRefreshEnabled(false);
//            rlvJiudian.setLoadMoreEnabled(false);
//            JiudianAdapter jiudianAdapter = new JiudianAdapter(mContext, list);
//            rlvJiudian.setAdapter(jiudianAdapter);
//        } else if (s.equals("52")) {//搬家
//            holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang_2)
//                    .setText(R.id.tv_shangjia_name, "KFFFSDDD");
//        } else if (s.equals("53") || item.equals("4")) {//滴滴
//            if (item.equals("13")) {//预约今天
//                holder.setVisible(R.id.tv_yuyue, false);
//            } else {//预约明天
//                holder.setVisible(R.id.tv_yuyue, true);
//            }
//            holder.setImageResource(R.id.iv_shangjia_icon, R.mipmap.touxiang)
//                    .setText(R.id.tv_shangjia_name, "GGHFHJFHF");
//        }
//    }
//
//    @Override
//    protected int getItemViewLayoutId(int position, AllIndentBean item) {
//        //待付款
//        if (item.getList().get(position).equals("0")) {//商城超市
//            return R.layout.unpaid_item;
//        } else if (item.getList().get(position).equals("1")) {//寄快递
//            return R.layout.unpaid_kuaidi_item;
//        } else if (item.getList().get(position).equals("2")) {//旅游
//            return R.layout.unpaid_lvyou_item;
//        } else if (item.getList().get(position).equals("3")) {//搬家
//            return R.layout.unpaid_banjia_item;
//        } else if (item.getList().get(position).equals("4")) {//宾馆
//            return R.layout.unpaid_binguan_item;
//        } else if (item.getList().get(position).equals("5")) {//酒店和外卖
//            return R.layout.unpaid_jiudian_item;
//        } else if (item.getList().get(position).equals("6") || item.getList().get(position).equals("7") || item.getList().get(position).equals("8")) {//帮我送,帮我买，帮我取
//            return R.layout.unpaid_bangwosong_item;
//            //        待接单类型
//        } else if (item.getList().get(position).equals("9")) {//搬家
//            return R.layout.unpaid_banjia_item;
//        } else if (item.getList().get(position).equals("10")) {//旅游
//            return R.layout.unpaid_lvyou_item;
//        } else if (item.getList().get(position).equals("11")) {//导游服务
//            return R.layout.unorder_daoyou_item;
//        } else if (item.getList().get(position).equals("12") || item.getList().get(position).equals("13")) {//宾馆,看房
//            return R.layout.unpaid_binguan_item;
//        } else if (item.getList().get(position).equals("14")) {//酒店和外卖
//            return R.layout.unpaid_jiudian_item;
//        }else if (item.getList().get(position).equals("16") || item.getList().get(position).equals("17")) {//司机，专车，滴滴
//            return R.layout.unorder_car_item;
//        } else if (item.getList().get(position).equals("18") || item.getList().get(position).equals("19")) {//酒店包间
//            return R.layout.unorder_jiudian_item;
//        } else if (item.getList().get(position).equals("20") || item.getList().get(position).equals("21") || item.getList().get(position).equals("22")) {//帮我送,买，取
//            return R.layout.unpaid_bangwosong_item;
//        } else if (item.getList().get(position).equals("23")) {//寄快递
//            return R.layout.unpaid_kuaidi_item;
////            已接单
//        } else if (item.getList().get(position).equals("24")) {//导游服务
//            return R.layout.unorder_daoyou_item;
//        } else if (item.getList().get(position).equals("25")) {//旅游
//            return R.layout.unpaid_lvyou_item;
//        } else if (item.getList().get(position).equals("26") || item.getList().get(position).equals("27") || item.getList().get(position).equals("28")) {//帮我送，买，取
//            return R.layout.unpaid_bangwosong_item;
//        } else if (item.getList().get(position).equals("29")) {//寄快递
//            return R.layout.unpaid_kuaidi_item;
//        } else if (item.getList().get(position).equals("30") || item.getList().get(position).equals("31")) {//宾馆,看房
//            return R.layout.unpaid_binguan_item;
//        } else if (item.getList().get(position).equals("32")) {//酒店包间
//            return R.layout.unorder_jiudian_item;
//        } else if (item.getList().get(position).equals("33") || item.getList().get(position).equals("34")) {//酒店外卖
//            return R.layout.unpaid_jiudian_item;
//        } else if (item.getList().get(position).equals("35") || item.getList().get(position).equals("36")) {//专车滴滴类的
//            return R.layout.unorder_car_item;
//        } else if (item.getList().get(position).equals("37")) {//搬家
//            return R.layout.unpaid_banjia_item;
//            //待收货，待发货
//        } else if (item.getList().get(position).equals("38") || item.getList().get(position).equals("39")) {
//            return R.layout.unpaid_item;
//            //已完成
//        } else if (item.getList().get(position).equals("40") || item.getList().get(position).equals("41") || item.getList().get(position).equals("42")) {//商城
//            return R.layout.unpaid_item;
//        } else if (item.getList().get(position).equals("43") || item.getList().get(position).equals("44") || item.getList().get(position).equals("45")) {//帮我买，送，取
//            return R.layout.unpaid_bangwosong_item;
//        } else if (item.getList().get(position).equals("46")) {//导游
//            return R.layout.unorder_daoyou_item;
//        } else if (item.getList().get(position).equals("47")) {//旅游
//            return R.layout.unpaid_lvyou_item;
//        } else if (item.getList().get(position).equals("48")) {//寄快递
//            return R.layout.unpaid_kuaidi_item;
//        } else if (item.getList().get(position).equals("49") || item.getList().get(position).equals("50")) {//宾馆，看房
//            return R.layout.unpaid_binguan_item;
//        } else if (item.getList().get(position).equals("51")) {//酒店外卖
//            return R.layout.unpaid_jiudian_item;
//        } else if (item.getList().get(position).equals("52")) {//搬家
//            return R.layout.unpaid_banjia_item;
//        } else if (item.getList().get(position).equals("53") || item.getList().get(position).equals("54")) {//滴滴
//            return R.layout.unorder_car_item;
//        } else if (item.getList().get(position).equals("55")) {//包间选择
//            return R.layout.unorder_jiudian_item;
//        }
//        return 0;
//    }
}
